﻿/***********************************************
 * CodeList.1
 * 文章：C# 中的委托和事件
 * 出处：http://www.tracefact.net/CSharp-Programming/Delegates-and-Events-In-CSharp.aspx
 * 日期：2007-9-20
 * 说明：本范例演示不使用委托时的一个例子
 * 作者：张子阳(Jimmy Zhang)
 * ********************************************/

using System;
using System.Collections.Generic;
using System.Text;

namespace Delegate {
	public enum Language{
		English, Chinese
	}

	class Program {
		private static void EnglishGreeting(string name) {
			Console.WriteLine("Morning, " + name);
		}

		private static void ChineseGreeting(string name) {
			Console.WriteLine("早上好, " + name);
		}

		private static void GreetPeople(string name, Language lang) {
			switch(lang){
				case Language.English:
					EnglishGreeting(name);
					break;
				case Language.Chinese:
					ChineseGreeting(name);
					break;
			}
		}
		
		static void Main(string[] args) {
			GreetPeople("Jimmy Zhang", Language.English);
			GreetPeople("张子阳", Language.Chinese);
			Console.ReadKey();
		}
	}
}
